package com.whksoft.mymapplugin.NMS;

import net.minecraft.server.v1_12_R1.NBTTagCompound;
import net.minecraft.server.v1_12_R1.NBTTagInt;
import org.bukkit.craftbukkit.v1_12_R1.inventory.CraftItemStack;
import org.bukkit.inventory.ItemStack;

public class NBT1_12_R1 extends NBT{
    public NBT1_12_R1(ItemStack item) {
        super(item);
    }

    @Override
    public ItemStack setMapID(int value) {
        return null;
    }

    public ItemStack setDataContainer(String s){
        net.minecraft.server.v1_12_R1.ItemStack nmsStack = CraftItemStack.asNMSCopy(item);
        NBTTagCompound tag = new NBTTagCompound();
        tag.set(s, new NBTTagInt(1));
        nmsStack.setTag(tag);
        item = CraftItemStack.asBukkitCopy(nmsStack);
        return item;
    }

    public static boolean hasTag(ItemStack itemStack, String keyName){
        net.minecraft.server.v1_12_R1.ItemStack nmsStack = org.bukkit.craftbukkit.v1_12_R1.inventory.CraftItemStack.asNMSCopy(itemStack);
        net.minecraft.server.v1_12_R1.NBTTagCompound tag = new net.minecraft.server.v1_12_R1.NBTTagCompound();
        tag.set(keyName, new net.minecraft.server.v1_12_R1.NBTTagInt(1));
        return nmsStack.hasTag();
    }
}
